package com.zx.template.controller;


import com.zx.template.base.R;
import com.zx.template.base.ValidationGroup;
import com.zx.template.pojo.dto.TestListDat;
import com.zx.template.pojo.dto.UserResumeDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/test")
@Api(tags = "测试 接口传 list 集合问题")
@Validated
public class TestInferface {


    @ApiOperation("新增 套餐")
    @PostMapping
    public R<Boolean> addCombo(@Validated(ValidationGroup.Add.class)  @RequestBody TestListDat dto)  {
    
        System.out.println(dto.getDtoList().size());
        return R.ok(Boolean.TRUE);
    }


    @ApiOperation("新增 套餐")
    @PostMapping("/3")
    public R<Boolean> addCombo3(@Validated(ValidationGroup.Add.class) @Valid @RequestBody List<UserResumeDto> dtoList)  {

        System.out.println(dtoList.size());
        return R.ok(Boolean.TRUE);
    }


    /** 传 [] 基本变量是可以的
     * @param dtoList 
     * @return
     */
    @ApiOperation("新增 套餐2")
    @PostMapping("/2")
    public R<Boolean> addCoxmbo2( @Valid @RequestBody List<String> dtoList)  {

        System.out.println(dtoList.size());
        return R.ok(Boolean.TRUE);
    }
    
}
